using System;
using System.Data;
using DotNetNuke;
using DotNetNuke.Framework;

namespace YourCompany.Modules.Cafeteria
{
	public abstract class DataProvider
	{

		#region common methods

		/// <summary>
		/// var that is returned in the this singleton
		/// pattern
		/// </summary>
		private static DataProvider instance = null;

		/// <summary>
		/// private static cstor that is used to init an
		/// instance of this class as a singleton
		/// </summary>
		static DataProvider()
		{
			instance = (DataProvider)Reflection.CreateObject("data", "YourCompany.Modules.Cafeteria", "");
		}

		/// <summary>
		/// Exposes the singleton object used to access the database with
		/// the conrete dataprovider
		/// </summary>
		/// <returns></returns>
		public static DataProvider Instance()
		{
			return instance;
		}

		#endregion


		#region Abstract methods

		/* implement the methods that the dataprovider should */

		public abstract IDataReader GetCafeteriaList();
		public abstract IDataReader GetCafeteria(int ItemID);
		public abstract void AddCafeteria(string ItemName, int ItemPrice);
		public abstract void UpdateCafeteria(int ItemID, string ItemName, int ItemPrice);
		public abstract void DeleteCafeteria(int ItemID);

		public abstract IDataReader GetOrderList();
		public abstract IDataReader GetOrder(int OrderID);
		public abstract void AddOrder(int ItemID, int ItemQuantity, string Room, int TotalPrice, DateTime Time, string ByUser, bool Completed);
		public abstract void UpdateOrder(int OrderID, int ItemID, int ItemQuantity, string Room, int TotalPrice, DateTime Time, string ByUser, bool Completed);
		public abstract void DeleteOrder(int OrderID);

		public abstract IDataReader GetAnnouncementList();
		public abstract IDataReader GetAnnouncement(int NewsID);
		public abstract void AddAnnouncement(DateTime Time, string Title, string Detail);
		public abstract void UpdateAnnouncement(int NewsID, DateTime Time, string Title, string Detail);
		public abstract void DeleteAnnouncement(int NewsID);

		#endregion

	}
}
